package org.example.myGetSet.controller;

import org.example.myGetSet.model.Result;
import org.example.myGetSet.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/demo")
public class DemoController {
    @Autowired
    DemoService demoService;

    @RequestMapping(value = "set", method = RequestMethod.GET)
    public Result<String> set(@RequestParam("input") String input) {
        System.out.println(input);
        String res = demoService.setService(input);
        return Result.success(res);
    }

    @RequestMapping(value = "get", method = RequestMethod.GET)
    public Result<String> get() {
        String res = demoService.getService();
        return Result.success(res);
    }
}
